#include "file.h"

static Fs_file* file = NULL;

namespace File
{
    bool open(const QString &s, int8_t mode)
    {
        if ((file = mini_open(Globals::QStringToChar(s).data(), mode)) != NULL)
        {mini_close(file);    return true;}
        else
        { return false; }
    }

    bool close()
    {
            if (file != NULL && mini_close(file) == RET_SUCCESS) {
                file = NULL;
                return true;
            }
            else
                return false;
    }

    bool del(const QString &s)
    {
            if (file_remove(Globals::QStringToChar(s).data()) == RET_SUCCESS)
                return true;
            else
                return false;
    }

    bool cp(const QString &s1, const QString & s2)
    {
            if (mini_cp(Globals::QStringToChar(s1).data(), Globals::QStringToChar(s2).data()) == RET_SUCCESS)
                return true;
            else
                return false;
    }
}
